package cumt.kydd.authoringplatform.mapper;

import org.apache.ibatis.annotations.Insert;
import cumt.kydd.authoringplatform.bean.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


public interface UserMapper
{
    @Insert("INSERT INTO user_info (name,password,salt)  VALUES(#{name}, #{password}, #{salt})")
    int insertUser(User user);

    @Select("SELECT name,password,salt From user_info WHERE name=#{name}")
    User selectUserByName(@Param("name")String name);

    @Update("Update user_info SET portrait=#{portrait} WHERE name=#{name}")
    int updatePortrait(@Param("portrait") String portrait, @Param("name")String name);

    @Select("SELECT portrait From user_info WHERE name=#{name}")
    String selectPortraitByName(@Param("name")String name);

    @Update("Update user_info SET info_email=#{info_email},info_org=#{info_org},info_profile=#{info_profile} WHERE name=#{name}")
    int updateInfo(@Param("info_email") String info_email,@Param("info_org") String info_org,@Param("info_profile") String info_profile, @Param("name")String name);

    @Select("SELECT info_email From user_info WHERE name=#{name}")
    String selectInfoEmailByName(@Param("name")String name);

    @Select("SELECT info_org From user_info WHERE name=#{name}")
    String selectInfoOrgByName(@Param("name")String name);

    @Select("SELECT info_profile From user_info WHERE name=#{name}")
    String selectInfoProfileByName(@Param("name")String name);

    @Update("Update user_info SET info_tel=#{info_tel} WHERE name=#{name}")
    int updateInfoTel(@Param("info_tel") String info_tel, @Param("name")String name);

    @Select("SELECT info_tel From user_info WHERE name=#{name}")
    String selectInfoTelByName(@Param("name")String name);

    @Update("Update user_info SET password=#{password} WHERE name=#{name}")
    int updatePassword(@Param("password") String password, @Param("name")String name);


}
